<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        /*
        li:nth-child(2n) {
            background-color: green;
        }
         */

        li:nth-child(2n+1) {
            background-color: red;
        }

        li:nth-child(-n+2) {
            background-color: orange;
        }
    </style>
</head>
<body>
<ul>
    <li>1</li>
    <li>2</li>
    <li>3</li>
    <li>4</li>
    <li>5</li>
    <li>6</li>
    <li>7</li>
    <li>8</li>
</ul>
</body>
</html>